import service from ".";

const bookApi={
    //分页
    selectByPage(pageNum, bname, bauthor){
        return service.get('/admin/book',{
            params:{
                pageNum,
                bname,
                bauthor
            }
        });
    },

    //添加
    insertBook(book){
        return service.post('/admin/book', book);
    },

    //删除
    deleteBook(bid){
        return service.delete(`/admin/book/${bid}`);
    },

    //修改
    updateBook(book){
        return service.put('/admin/book', book);
    },

    //根据书籍id查询
    selectBuBid(bid){
        return service.get(`/admin/book/ByBid/${bid}`);
    },

    //查询所有
    selectAll(){
        return service.get('/admin/book/All');
    },

    //根据书名查询
    selectByBname(bname){
        return service.get('/admin/book/ByBname', bname);
    },

    //分类并查询
    selectBidAndCid(cname){
        return service.get(`/admin/book/BidAndCid/${cname}`);
    },
    
    //根据cid查询
    selectByCid(cid){
        return service.get(`/admin/book/selectByCid/${cid}`);
    },
    //搜索框中根据ID查询
    selectByBAndC(bid){
        return service.get('/admin/book/BC', bid);
    },
    //查询所有书籍
    selectBook(){
        return service.get('/admin/book/Book');
    },
    //获取所有用户信息
    allAdmin(bid){
        return service.get(`/admin/book/Admin/${bid}`);
    },
    //分配用户
    insertBidAndAid(bid, aids){
        return service.post('/admin/book/bidAndAid', {
            bid,
            aids
        });
    }
}
export default bookApi;

